package com.battle.service.controller.web;

import com.battle.pojo.param.questionBankStudy.*;
import com.battle.pojo.vo.examStudyDetails.GetExamStudyDetailsVo;
import com.battle.pojo.vo.questionBankDetailsStudy.GetQuestionBankDetailsStudyVo;
import com.battle.pojo.vo.questionBankStudy.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/题库学习
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/questionBankStudy/web")
public class QuestionBankStudyWebController {

    private final QuestionBankStudyService service;

    public QuestionBankStudyWebController(QuestionBankStudyService service) {
        this.service = service;
    }


    /**
     *开始学习题库
     *
     * @param param
     * @return
     */
    @PostMapping("/createQuestionBankStudy")
    public ApiResult<Long> createQuestionBankStudy(@RequestBody @Valid CreateQuestionBankStudyParam param) {
        return ApiResult.ok(service.createQuestionBankStudy(param));
    }


    /**
     * 回答题目
     *
     * @param param
     */
    @PutMapping("/editQuestionBankStudy")
    public ApiResult editQuestionBankStudy(@RequestBody @Valid EditQuestionBankStudyParam param) {
        service.editQuestionBankStudy(param);
        return ApiResult.ok();
    }


    /**
     * 获取题库学习详情
     *
     * @param bankStudyId
     * @return
     */
    @GetMapping("/getQuestionBankStudy")
    public ApiResult<GetQuestionBankStudyVo> getQuestionBankStudy(@RequestParam("bankStudyId") Long bankStudyId) {
        GetQuestionBankStudyVo vo = service.getQuestionBankStudy(bankStudyId);
        return ApiResult.ok(vo);
    }

    /**
     * 根据id获取题库题目详情
     *
     * @param id
     * @return
     */
    @GetMapping("/getQuestionBankDetailsStudy")
    public ApiResult<GetQuestionBankDetailsStudyVo> getQuestionBankDetailsStudy(@RequestParam("id") Long id) {
        GetQuestionBankDetailsStudyVo vo = service.getQuestionBankDetailsStudy(id);
        return ApiResult.ok(vo);
    }

}

